// JavaScript Document
$(document).ready(function() {
    /*
	$('#reg-boton').click(function(){
		var valor1 = $('#pass').attr('value');
		var valor2 = $('#vpass').attr('value');
			if(valor1 != valor2){
				$('.error').html('<h2>Los passwords no coinciden</h2>');
			}
	});
	*/
                        
    jQuery.validator.addMethod("lettersonly", function(value, element) {
        return this.optional(element) || /^[a-z]+$/i.test(value);
    }, "Please enter only letters without space."); 
                                        
    // validate contact form on keyup and submit
    $("#form").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields
        rules: {
                        
            name: {
                required: true,
                minlength: 3,
                maxlength:50  
            //lettersonly: false
            },
            email: {
                required: true,
                email: true
            },
			
            tema: {
                required :true
            },
                                
            mensaje: {
                required :true
            }   
                                
        },
        
        messages: {
                        
            name: {
                required: "El nombre es requerido.",
                maxlength: $.validator.format("Ingresa no mas de {0} caracteres."),
                minlength: $.validator.format("Ingresa al menos {0} caracteres."),
            },
                                
            email: "El correo es requerido.",
			
            tema: "El tema es requerido.",
                                
            mensaje: "El mensaje es requerido."                       
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });
	
    // validate contact form on keyup and submit
    $("#pass-olvidado").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields
        rules: {
                        
            email: {
                required: true,
                email: true
            },
        },
        
        messages: {
                                
            email: "El correo es requerido.",
			
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });
	
    /*###############################*/	
	
    $("#form-email").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields
        rules: {
			
                         
            email: {
                required: true,
                email: true
            },
			
            remitente: {
                required: true,
                minlength: 3,
                maxlength:50  
            //lettersonly: false
            },
			
            emailremitente: {
                required: true,
                email: true
            },
			
            tema: {
                required :true
            }  
                                
        },
        //set messages to appear inline
        messages: {
			
            email: "El correo es requerido.",
			
                        
            remitente: {
                required: "El remitente es requerido.",
                maxlength: $.validator.format("Ingresa no mas de {0} caracteres."),
                minlength: $.validator.format("Ingresa al menos {0} caracteres."),
            },
                                
            emailremitente: "El correo es requerido.",
			
            tema: "El tema es requerido.",
                                                      
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });
	
    /*################################*/
    $("#form-dir").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields
        rules: {
                        
            nombre: {
                required: true,
                minlength: 3,
                maxlength:50  
            //lettersonly: false
            },
            email: {
                required: true,
                email: true
            },
			
            tema: {
                required :true
            },
                                
            mensaje: {
                required :true
            }   
                                
        },
        //set messages to appear inline
        messages: {
                        
            nombre: {
                required: "El nombre es requerido.",
            },
                                
            email: "El correo es requerido.",
			
            tema: "El tema es requerido.",
                                
            mensaje: "El mensaje es requerido."                       
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });

    /*###########################################*/
    $("#form-reg").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields		
        rules: {
			
            name: {
                required: true,
                minlength: 3,
                maxlength:50  
            //lettersonly: false
            },
			
            user: {
                required: true,
                minlength: 3,
                maxlength:50  
            //lettersonly: false
            },
                         
            email: {
                required: true,
                email: true
            },
			
            pass: {
                required: true,
            },
			
            vpass: {
                required: true,
            }
                                
        },
        //set messages to appear inline
        messages: {
                        
            name: {
                required: "El nombre es requerido.",
                maxlength: $.validator.format("Ingresa no mas de {0} caracteres."),
                minlength: $.validator.format("Ingresa al menos {0} caracteres."),
            },
			
            user: {
                required: "El usuario es requerido.",
            },
                                
            email: "El correo es requerido.",
			
            pass: "La contraseña es requerida.",
			
            vpass: "La contraseña es requerida.",
                                                      
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });
	
	  
    /*############FORM-PAYPAL###################*/
    $("#form-paypal").validate({
                        
        errorElement: "span", 
                         
                         
        //set the rules for the fields
        rules: {
                        
            name: {
                required: true,
                minlength: 5,
                maxlength:50  
            //lettersonly: false
            },
			
            user: {
                required: true,
                minlength: 5,
                maxlength:50  
            //lettersonly: false
            },
			
            email: {
                required: true,
                email: true
            },
			
            address: {
                required :true
            },
                                
            city: {
                required :true
            }, 
			
            estate: {
                required :true
            },
            zp: {
                required :true
            },
            country: {
                required :true
            }                        
        },
        //set messages to appear inline
        messages: {
                        
            name: {
                required: "El nombre es requerido.",
            },
			
            user: "El usuario es requerido.",
                                
            email: "El correo es requerido.",
			
            address: "La direccion es requerido.",
                                
            city: "La ciudad es requerdio.",
			
            state: "El estado es requerido.", 
			
            zp: "El cp es requerido.",   
			
            zp: "El país es requerido."                   
        },
                        
        errorPlacement: function(error, element) {               
            error.appendTo(element.parent());     
        }

    });
});